package com.ybfenpan.service.log;


import com.ybfenpan.model.Member;
import com.ybfenpan.model.ParamWage;
import com.ybfenpan.model.log.LogShui;
import com.ybfenpan.service.MemberService;
import com.ybfenpan.service.ParamWageService;
import com.ybfenpan.service.core.BaseService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;


@Service
public class LogShuiService extends BaseService {

    @Resource
    private MemberService memberService;

    @Resource
    private ParamWageService paramWageService;

    /**
     * @功能 通过审核
     */
    public void updateCommitOne(LogShui one) {

        Integer state = one.getState();
        if (state.equals(10)) {
            Member member = this.memberService.getByKey(one.getMemberId());

            Map<String, Object> paramMember = new HashMap<String, Object>();
            paramMember.put("id", member.getId());
            paramMember.put("diyUpdate", "shui=shui+" + one.getNum());
            this.memberService.update(paramMember);
            member = memberService.getByKey(member.getId());
            one.setState(20);
            one.setCommitDate(new Date());
            one.setTitle("成功购买报单码");
            one.setYu(member.getShui());
            this.saveOrUpdate(one);


        }
    }

}
